//
//  XHTabBarViewController.swift
//  XHSwift_Test_Demo
//
//  Created by MrYeL on 2018/9/19.
//  Copyright © 2018年 MrYeL. All rights reserved.
//

import UIKit

class XHTabBarViewController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()

        let homeVC = HomeTableVC()
        let mineVC = MineTableVC()
        
        self.addChildViewController(configVC(vc: homeVC, title: "首页", imageName: "tabbar_discover_normal", selImageName: "tabbar_home_select"))
        self.addChildViewController(configVC(vc: mineVC, title: "我的", imageName: "tabbar_mine_normal", selImageName: "tabbar_mine_select"))
        
        // Do any additional setup after loading the view.
    }
    
    func configVC(vc:UIViewController,title:String,imageName:String,selImageName:String) -> UINavigationController {
        
        vc.tabBarItem.image = UIImage(named: imageName)
        vc.tabBarItem.selectedImage = UIImage(named:selImageName)
        vc.tabBarItem.title = title
        let nav = UINavigationController(rootViewController: vc)
        return nav
    }

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destination.
        // Pass the selected object to the new view controller.
    }
    */

}
